/*
Copyright (C) 2013-2021 LZE
Prog:Binary Indexed Tree
*/
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define mod 1000000007
#define eps 1e-6
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N = 40000010;
ll n,m;
ll a[N],tree[N] = {0};
inline ll lowbit(ll x) { return x & (-x); }
void updata(ll idx,ll val) {
    tree[idx] += val;
	while(idx < n) { tree[idx + lowbit(idx)] += val; idx = idx + lowbit(idx); }
}
ll preSum_query(ll x) {
	ll sum = tree[x];
	while(x > 1) { sum = sum + tree[x - lowbit(x)]; x = x - lowbit(x); }
	return sum;
}
int main() {
	scanf("%lld%lld",&n,&m);
    ll act,x,y,k;
    for(ll i = 1;i <= n;i++) {
        scanf("%lld",&x);
        updata(i,x); updata(i + 1,-x);
    }
    for(ll i = 1;i <= m;i++) {
        scanf("%lld",&act);
        switch(act) {
            case 1 : {
                scanf("%lld%lld%lld",&x,&y,&k);
                updata(x,k); updata(y + 1,-k);
                break;
            }
            case 2 : {
                scanf("%lld",&x);
                printf("%lld\n",preSum_query(x));
                break;
            }
        }
    }
	return 0;
}